<?php
/**
 * Layout du pied page
 *
 * @author Cyril Souti
 * @version 1.0
 * @package layouts
 *
 */
?>

<div id="content">
    <?php
    $this->navigationVisible();
    $mainContainer = $this->navigation()->getContainer();
    $currentArray = $this->navigation()->findActive($mainContainer);
    $currentPage = null;
    if (array_key_exists('page', $currentArray)) {
        $currentPage = $currentArray['page'];
    }
    ?>

    <h1><?= $this->reformatText($this->title) ?></h1>

    <?php
    $parents = array();
    $parent = $currentPage;
    while (($parent = $parent->getParent()) != $mainContainer) {
        array_push($parents, $parent);
    }
    $parents = array_reverse($parents);
    ?>

    <?php foreach ($parents as $parent) : ?>
        <nav class="menuSimple">
            <?=
            $this->navigation()
                ->menu()
                ->renderMenu($parent); ?>
        </nav>
    <?php endforeach; ?>

    <?php if ($currentPage->hasPages()): ?>
        <nav class="menuSimple">
            <?=
            $this->navigation()
                ->menu()
                ->renderSubMenu(null, 'subItem', 4); ?>
        </nav>
    <?php endif ?>

    <?= $this->layout()->content ?>
</div>